Download

Acrobat file (131K)
Download

ClarisWorks 4 file (38K)
Download Technotes 1013-1026

QuickView file (284K)

T E C H N O T E :
Color Cursing:
Two Major Causes


TECHNOTE 1020 FEBRUARY 1996


by Alan Mimms
revised by Michael Marinkovich
marink@applelink.apple.com
Apple Developer Technical Support (DTS)

The creation and use of color cursors is discussed in the chapter on cursor utilities in Inside Macintosh: Imaging with QuickDraw.

If you're building an application that uses color cursors, you may encounter some quirks present in Color QuickDraw. This Technote provides solutions to two common problems.


CONTENTS

Using Color Cursors

To avoid system errors or crashes while using a color cursor, incorporate the following information in your application development.

Setting Bounds for your Cursor

If your cursor is, for example, 15 pixels tall and 9 pixels wide, you might be tempted to use these values for the bounds.bottom and bounds.right, respectively, in your cursor's pixel map. Don't. When the cursor's image needs to be expanded (that is, when you specify a two bit-per-pixel cursor and the mouse pointer is on an eight-bit screen) the SetCCursor trap rounds the width of the pixel map in such a way that you'll get only the space required for a 15 by 8 pixel map allocated for the expanded cursor data. When the cursor's image is expanded into this too-small expanded cursor data handle as a 15 by 9 pixel map, something in your heap will get munched.

To avoid this problem, always specify the pixmapHandle^^.bounds to be 16 by 16. This will cause SetCCursor to properly allocate the expanded data area. Since the amount of data drawn for a cursor is specified by the cursor's pixel values and 'clut' resource, trying to save a few bytes by making the bounds rectangle smaller than 16 by 16 won't be very helpful anyway.

Inopportune Purging of a `CLUT' resource

If you load a color cursor's color table from a 'clut' resource using GetCTable, make sure that the 'clut' is marked non-purgeable while the color cursor is in use. If you don't take this precaution, bombs will occur if your 'clut' gets purged at an inopportune time.

Further Reference

For more information, see Inside Macintosh: Imaging with QuickDraw, "Cursor Utilities."

Change History

This Technote was originally written in June, 1989.

Since June, 1989, a warning has been added about purgeable 'clut' resources.


Return to Technotes Table of Contents
Return to About Macintosh Technotes
Return to Developer Services and Products

Apple | Servers | What's New | Index | Feedback | Help


© Apple Computer, Inc.

Send feedback to devfeedback@applelink.apple.com.

[last modified by fch on 1-Feb-96]